package com.ccnf.model.mapper;

import com.ccnf.model.entity.InvitationAccount;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author developer
 * @since 2018-09-08
 */
public interface InvitationAccountMapper extends BaseMapper<InvitationAccount> {

    InvitationAccount selectByInvitationIdAndUserId(@Param("invitationId") Long invitationId,
                                                    @Param("userId") Long userId);

    /**
     * 减少账户的余额
     * @param accountId 账户ID
     * @param cashAmount 减少的金额
     * @return 返回影响的行数，成功返回1，失败返回0
     */
    Integer reduceAccountMoney(@Param("accountId") Long accountId,
                               @Param("cashAmount") BigDecimal cashAmount);


    /**
     * 增加账户的余额
     * @param accountId 账户ID
     * @param cashAmount 增加的金额
     * @return 返回影响的行数，成功返回1，失败返回0
     */
    Integer addAccountMoney(@Param("accountId") Long accountId,
                            @Param("cashAmount") BigDecimal cashAmount);
}